package com.falcon.modules.domain.dto;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;

import java.util.Date;

@TableName("s_sys_menu")
@Data
public class Menu extends SuperEntity<Menu> implements Comparable {
    private String name;
    private Long pid;
    private String url;
    private Integer type;
    private String description;
    private Integer state;
    private Integer sort;
    @TableField("home_page")
    private Boolean homePage;
    @TableField("create_time")
    private Date createTime;

    @Override
    public int compareTo(Object o) {
        if(o==null){
            return 1;
        }
        if(this.sort == null){
            return -1;
        }

        if(this.sort>((Menu)o).sort){
            return 1;
        }
        if(this.sort<((Menu)o).sort){
            return -1;
        }
        return 0;
    }

}
